package DependencyModeling;

import java.util.ArrayList;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import CheckBoxList.CheckBoxList;
import CheckBoxList.CheckBoxListEntry;

public class aPriori extends JFrame {
	private static final long serialVersionUID = 8092055964737009822L;

	private static Double SupportLevel = 3.0/7;
	private static DataSet set;
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		ArrayList<DataItem> items = new ArrayList<DataItem>(2);
		ArrayList<String> strings = new ArrayList<String>(2);
		strings.add("1");
		strings.add("2");
		items.add(new DataItem(strings));
		
		ArrayList<String> strings2 = new ArrayList<String>(strings);
		strings2.add("4");
		items.add(new DataItem(strings2));
		
		ArrayList<String> strings3 = new ArrayList<String>(strings2);
		strings3.add("3");
		items.add(new DataItem(strings3));
		
		ArrayList<String> strings4 = new ArrayList<String>(2);
		strings4.add("2");
		strings4.add("3");
		items.add(new DataItem(strings4));
		
		ArrayList<String> strings5 = new ArrayList<String>(strings4);
		strings5.add("4");
		items.add(new DataItem(strings5));
		
		ArrayList<String> strings6 = new ArrayList<String>(2);
		strings6.add("3");
		strings6.add("4");
		items.add(new DataItem(strings6));
		
		ArrayList<String> strings7 = new ArrayList<String>(2);
		strings7.add("2");
		strings7.add("4");
		items.add(new DataItem(strings7));
		
		set = new DataSet(items);
		PrintMatchingItems(set);
	}
	
	public static void PrintMatchingItems(DataSet set)
	{
		set.BuildPermutation(set.possibleItems);
		set.PrintPermutations(false);
		set.PrintDataSet();
		set.ComputeSupport(SupportLevel);
		set.PrintPermutations(true);
	}
	
	public static void Draw(DataSet set)
	{
		JFrame frame = new JFrame("A Priori");
		
		JMenuBar menuBar;
		JMenu menu, submenu;
		JMenuItem menuItem;
		
		menuBar = new JMenuBar();
		menu = new JMenu("Test");
		submenu = new JMenu("SubMenu");
		menu.add(submenu);
		menuItem = new JMenuItem("Hello World");
		submenu.add(menuItem);
		
		menuBar.add(menu);
		
		CheckBoxList cbList = new CheckBoxList();
		
		for (String option : set.possibleItems)
		{
			cbList.add(new CheckBoxListEntry(option, false));
		}
		cbList.setLocation(80, 80);
		cbList.validate();
		
		frame.add(cbList);
		frame.setJMenuBar(menuBar);
		
		frame.setBounds(80, 80, 400, 400);
		frame.setVisible(true);
	}

}